/**
 * Date：2017.05.13 星期六 下午
 * Function：书籍控制器 
 * E-mail：woaitianwen@qq.com
 * Author：zhouyulong
 */

'use strict';

var mongoose = require('mongoose'),
    Book = mongoose.model('Books');


//读取全部书籍
exports.Index = function(req, res) {
        Book.find ({}, function(err, book) {
            if (err)
            res.send(err);
            res.json(book);
        });
};

//读取书籍的ID
exports.ReadId = function(req, res) {
     Book.findById(req.params.bookId, function(err, book) {
         if (err)
         res.send(err);
         res.json(book);
     });
};
